﻿using System.ComponentModel;

namespace MyFloridaHouse.SilverlightOpenDistricts
{
    public partial class MainPage
    {
        // this is a VIEW trigger that listens for a property changed event in the VIEW-MODEL

        private void InitializePropertyChangedListener()
        {
            viewModelBase.PropertyChanged += new PropertyChangedEventHandler(OnPropertyChangedHandler);
        }


        // need to listen for any dependent properties that cause an effect in the VIEW
        public void OnPropertyChangedHandler(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "isBingVisible")
            {
                onToggleBingVisibility();
            }

            else if (e.PropertyName == "isDistrictRenumberDialogActive")
            {
                if (viewModelBase.isDistrictRenumberDialogActive)
                    InitializeDistrictRenumberDiaglog();
            }

            else if (e.PropertyName == "isLeftMenuVisible")
            {
                onLeftMenuChange();
            }

            else if (e.PropertyName == "isRightMenuVisible")
            {
                onRightMenuChange();
            }


            else if (e.PropertyName == "saveRightMenuColumnWidth")
            {
                onSaveRightMenuColumnWidth();
            }

            else if (e.PropertyName == "saveLeftMenuColumnWidth")
            {
                onSaveLeftMenuColumnWidth();
            }

        }
    }
}
